<extend name="Layout/index"/>
<block name='header'>
    <link href="__PUBLIC__/Dist/css/bootstrap.min.css" rel="stylesheet">
</block>
<block name="main_content">
	 <div class="container" style="width:1043px; padding-right:71px">
	 	<div class="page-header">
       	 	<h1> 修改密码</h1>
     	</div>
     	<div class="row">
			<div class="col-xs-12">
				<form class="form-horizontal" id="myform" action='<{:U("Info/dePass")}>' method='post'>
				  <div class="form-group">
				    <label for="inputEmail3" class="col-sm-2 control-label">当前密码:</label>
				    <div class="col-sm-3">
				      <input type="password" class="form-control" onblur="tpass(this)" name='pass' value="">
				    </div>
				    <div class="col-sm-3" id="t1" style="height:36px;padding-left: 0px;line-height:36px;">请输入原密码</div>
				  </div>
				  <div class="form-group">
				    <label for="inputEmail3" class="col-sm-2 control-label">新密码:</label>
				    <div class="col-sm-3">
				      <input type="password" class="form-control" id="momo1" onblur="newpass(this)" name='newPass' value="">
				    </div>
				    <div class="col-sm-3" id="t2" style="height:36px;padding-left: 0px;line-height:36px;">请输入新密码</div>
				  </div>
				  <div class="form-group">
				    <label for="inputEmail3" class="col-sm-2 control-label">确认新密码:</label>
				    <div class="col-sm-3">
				      <input type="password" class="form-control" id="momo2" onblur="Rtpass(this)" name='Rpass' value="">
				    </div>
				     <div class="col-sm-3" id="t3" style="height:36px;padding-left: 0px;line-height:36px;">再次输入密码</div>
				  </div>
				  <div class="form-group">
				  	<button id="btn" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" style="background-color:#b74635;width:75px;height:46px;color:#fff;font-size:20px;border:none;border-radius:15px;margin-left:135px;margin-top:20px">修改</button>
					<!-- 弹框 -->
						<!-- Button trigger modal -->
				<!-- Modal -->
				<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
							<div class="modal-dialog" role="document">
								<div class="modal-content">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
										<h4 class="modal-title" id="myModalLabel">提示</h4>
									</div>
									<div class="modal-body" id="momobody">
									</div>
									<div class="modal-footer">
										<button type="button" id="momoreturn" class="btn btn-default" data-dismiss="modal">确认</button>
									</div>
								</div>
							</div>
						</div>
					</div>
					<!-- 弹框 -->
				  </div>
				</form>
			</div>
		</div>
   </div>
   <script src="__PUBLIC__/Dist/jquery.min.js"></script>
   <script src="__PUBLIC__/Dist/js/bootstrap.min.js"></script>
   <script type="text/javascript">

   		$("#momoreturn").click(function(){
             
   				var abbf=$('#momobody').text();
   			if( abbf =='修改失败'){

   				 window.location.href="<{:U('Info/upPass')}>";
   			}else{
   				window.location.href="<{:U('Public/index')}>";
   			}
   			
   		});
   		function tpass(ttp){
   			if(ttp.value==""){
   				$('#t1').html('输入6-16位的英文字母或数字').css("color","red");
   			}else{
   				$('#t1').html('');
   			}
   		}
   		function newpass(ttp){
   			if(ttp.value==""){
   				$('#t2').html('输入6-16位的英文字母或数字').css("color","red");
   			}else{
   				$('#t2').html('');
   			}
   		}
   		function Rtpass(ttp){
   			if(ttp.value==""){
   				$('#t3').html('输入6-16位的英文字母或数字').css("color","red");
   			}else{
   				var tp1=$('#momo1').val();
   				// console.log(tp1);
   				var tp2=$('#momo2').val();
   				// console.log(tp2);
   				if(tp1!=tp2){ $('#t3').html('两次密码不一致').css("color","red");}
   					else{
   						 $('#t3').html('');
   				}
   			}
   		}
   		$("#myform").submit(function(){
   			$.ajax({
   				url:"<{:U('Info/dePass')}>",
   				type:'post',
   				data:$("#myform").serialize(),
   				dataType:'json',
   				success:function(dis){
   					/*console.log(dis);*/
   					if(dis==1){
   						console.log(dis);
   						$('#momobody').html('修改成功');
   					}else{
   						$('#momobody').html('修改失败');
   					}
   				}
   			})
   			return false;
   		});
	</script>
</block>